package com.pzb.wechat.service.impl;

import java.util.List;
import com.pzb.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.pzb.wechat.mapper.WechatShoppingCartMapper;
import com.pzb.wechat.domain.WechatShoppingCart;
import com.pzb.wechat.service.IWechatShoppingCartService;

/**
 * 购物车Service业务层处理
 * 
 * @author Mr_Wu
 * @date 2022-01-19
 */
@Service
public class WechatShoppingCartServiceImpl implements IWechatShoppingCartService 
{
    @Autowired
    private WechatShoppingCartMapper wechatShoppingCartMapper;



    @Override
    public WechatShoppingCart selectWechatShoppingCart(String openid, String extAppid, Long goodsId, String goodsUnit) {
        return wechatShoppingCartMapper.selectWechatShoppingCart(openid,extAppid,goodsId,goodsUnit);
    }

    @Override
    public Integer selectShoppingCartTotal(String openid, String extAppid) {
        return wechatShoppingCartMapper.selectShoppingCartTotal(openid,extAppid);
    }

    /**
     * 查询购物车列表
     * 
     * @param
     * @return 购物车
     */
    @Override
    public List<WechatShoppingCart> selectWechatShoppingCartList(String openid, String extAppid)
    {
        return wechatShoppingCartMapper.selectWechatShoppingCartList(openid,extAppid);
    }

    /**
     * 新增购物车
     * 
     * @param wechatShoppingCart 购物车
     * @return 结果
     */
    @Override
    public int insertWechatShoppingCart(WechatShoppingCart wechatShoppingCart)
    {
        wechatShoppingCart.setCreateTime(DateUtils.getNowDate());
        return wechatShoppingCartMapper.insertWechatShoppingCart(wechatShoppingCart);
    }

    /**
     * 修改购物车
     * 
     * @param wechatShoppingCart 购物车
     * @return 结果
     */
    @Override
    public int updateWechatShoppingCart(WechatShoppingCart wechatShoppingCart)
    {
        return wechatShoppingCartMapper.updateWechatShoppingCart(wechatShoppingCart);
    }

    /**
     * 批量删除购物车
     * 
     * @param ids 需要删除的购物车主键
     * @return 结果
     */
    @Override
    public int deleteWechatShoppingCartByIds(List<Long> ids)
    {
        return wechatShoppingCartMapper.deleteWechatShoppingCartByIds(ids);
    }

    @Override
    public List<WechatShoppingCart> selectWechatShoppingCartListByIds(String extAppid,List<Long> cartIds,String provinceCode) {
        return wechatShoppingCartMapper.selectWechatShoppingCartListByIds(extAppid,cartIds,provinceCode);
    }

}
